#ifndef _WWWSRVCONN_HXX_
#define _WWWSRVCONN_HXX_

#include <mythread.hxx>
#include <safeque.hxx>

#include "priv/auconnmanager.hxx"

typedef struct tagBridgeMsg tBridgeMsg;
class TcpSocket;
class FileLog;
class BridgeNet;

class AuConn : public Thread
{
public:
  //
  AuConn(AuConnManager *manager, TcpSocket* remote, FileLog *filelog);
  virtual ~AuConn();

  void Shutdown();

  void SendMsg(tBridgeMsg* bmsg);

protected: 
  virtual void Execute(Arg arg);
  AuConn(const AuConn &model);

  //
  bool HandleIn(void);
  bool HandleOut(void);

  void HandleMsg(tBridgeMsg* bmsg);
  
  AuConnManager *_manager;
 
  SafeQue<tBridgeMsg*> _out_que; 
  TcpSocket* _remote;
  string _username;

  bool _shutdown_requested;
  FileLog *_filelog;
};

#endif //_WWWSRVCONN_HXX_
